home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / tools / player6.1a / source / 610.1.g < prev    next >
Encoding:
Text File  |  1980-01-04  |  39.8 KB  |  2,652 lines

  1.  
  2. bbra.b        macro
  3.         bra.b    \1
  4.         cnop    0,4
  5.         endm
  6. rrts        macro
  7.         rts
  8.         cnop    0,4
  9.         endm
  10.  
  11.  
  12. * The Player 6.1A for Asm-One 1.09 and later *
  13.  
  14. ;start = 6    ;Starting position
  15.  
  16. fade  = 0    ;0 = Normal, NO master volume control possible
  17.         ;1 = Use master volume (P61_Master)
  18.  
  19. jump = 0    ;0 = do NOT include position jump code (P61_SetPosition)
  20.         ;1 = Include
  21. system = 1    ;0 = killer
  22.         ;1 = friendly
  23.  
  24. CIA = 0        ;0 = CIA disabled
  25.         ;1 = CIA enabled
  26.  
  27. exec = 1    ;0 = ExecBase destroyed
  28.         ;1 = ExecBase valid
  29.  
  30. lev6 = 1    ;0 = NonLev6
  31.         ;1 = Lev6 used
  32.  
  33. opt020 = 1    ;0 = MC680x0 code
  34.         ;1 = MC68020+ or better
  35.  
  36. channels = 3    ;amount of channels to be played
  37.  
  38. use = -1    ;The Usecode
  39.  
  40.     incdir    coding:os2.0/include2.0/
  41.     include coding:tools/player6.1a/source/include/Player61.i
  42.  
  43. *-----------------------------------------------*
  44.  
  45.     printt    ""
  46.     printt    "Options used:"
  47.     printt    "-------------"
  48.     ifd    start
  49.     printt    "Starting from position"
  50.     printv    start
  51.     endc
  52.     ifne    fade
  53.     printt    "Mastervolume on"
  54.     else
  55.     printt    "Mastervolume off"
  56.     endc
  57.     ifne    system
  58.     printt    "System friendly"
  59.     else
  60.     printt    "System killer"
  61.     endc
  62.     ifne    CIA
  63.     printt    "CIA-tempo on"
  64.     else
  65.     printt    "CIA-tempo off"
  66.     endc
  67.     ifne    exec
  68.     printt    "ExecBase valid"
  69.     else
  70.     printt    "ExecBase invalid"
  71.     endc
  72.     ifne    lev6
  73.     printt    "Level 6 IRQ on"
  74.     else
  75.     printt    "Non-lev6 NOT IMPLEMENTED!"
  76.     if2
  77.     fail
  78.     endc
  79.     endc
  80.     ifne    opt020
  81.     printt    "MC68020 optimizations"
  82.     else
  83.     printt    "Normal MC68000 code"
  84.     endc
  85.     printt    "Channels:"
  86.     printv    channels
  87.     ifgt    channels-4
  88.     printt    "NO MORE THAN 4 CHANNELS!"
  89.     if2
  90.     fail
  91.     endc
  92.     endc
  93.     ifeq    channels
  94.     printt    "MUST HAVE AT LEAST 1 CHANNEL!"
  95.     if2
  96.     fail
  97.     endc
  98.     endc
  99.     printt    "UseCode:"
  100.     printv    use
  101.  
  102. *-----------------------------------------------*
  103.  
  104.  
  105.     section    Player6.1A,code
  106.  
  107. aa
  108.         bsr    go
  109. bb        rrts
  110.  
  111. go
  112.  
  113.     movem.l    d0-a6,-(sp)
  114.     lea    $dff000,a6
  115.     ifeq    system
  116.     move    $1c(a6),-(sp)
  117.     move    #$7fff,$9a(a6)
  118.     move    2(a6),-(sp)
  119.     move    #$7ff,$96(a6)
  120.     endc
  121.  
  122.     lea    P61_data,a0    ;Module
  123. ;    lea    temp,a0
  124.     sub.l    a1,a1        ;Samples
  125.     lea    samples,a2    ;Sample buffer
  126.     moveq    #0,d0        ;Auto Detect
  127.     bsr    P61_motuuli+P61_InitOffset
  128.  
  129.     tst    d0        ;Went ok?
  130.     bne    P61_exit
  131.  
  132. P61_sync
  133.     ifeq    CIA
  134. ;    move.l    4(a6),d0
  135. ;    andi.l    #$1ff00,d0
  136. ;    cmp.l    #$8100,d0
  137. ;    bne.b    P61_sync
  138.  
  139. P61_sync2    move.l    4(a6),d0
  140.         andi.l    #$1ff00,d0
  141.         cmp.l    #$8200,d0
  142.         bne.b    P61_sync2
  143.  
  144.     move.w    #$f00,$180(a6)
  145.         moveq    #0,d0
  146.         move    6(a6),d0
  147.         sub.l    #$8200,d0
  148.         cmp.l    P61_raster(pc),d0
  149.         ble.b    P61_kosj
  150.         move    d0,P61_raster+2
  151. P61_kosj
  152.     tst    P61_raster2+2
  153.     bne.b    P61_doing
  154.     move    d0,P61_raster2+2
  155.     bbra.b    P61_doneg
  156. P61_doing
  157.     add.l    P61_raster2(pc),d0
  158.     asr.l    #1,d0
  159.     move.l    d0,P61_raster2
  160. P61_doneg
  161.     addq.l    #1,P61_frames
  162.  
  163.     ifne    fade
  164.     btst    #10,$16(a6)
  165.     bne.b    P61_jid
  166.     move    P61_diri(pc),d0
  167.     sub    d0,P61_motuuli+P61_MasterVolume
  168.     bne.b    P61_judo
  169.     neg    P61_diri
  170.     bbra.b    P61_jid
  171. P61_judo
  172.     cmp    #64,P61_motuuli+P61_MasterVolume
  173.     bne.b    P61_jid
  174.     neg    P61_diri
  175.     endc
  176.  
  177. P61_jid
  178.  
  179.     bsr    P61_motuuli+P61_MusicOffset
  180.     move.w    #$bbc,$180(a6)
  181.  
  182.     endc
  183.  
  184.     btst    #6,$bfe001
  185.     bne    P61_sync
  186.  
  187. P61_exit
  188.     bsr    P61_motuuli+P61_EndOffset
  189.  
  190.     ifeq    system
  191.     move    (sp)+,d7
  192.     bset    #15,d7
  193.     move    #$7ff,$96(a6)
  194.     move    d7,$96(a6)
  195.  
  196.     move    (sp)+,d7
  197.     bset    #15,d7
  198.     move    #$7fff,$9a(a6)
  199.     move    d7,$9a(a6)
  200.     endc
  201.     movem.l    (sp)+,d0-a6
  202.  
  203.     move.l    P61_raster(pc),d0
  204.     move.l    P61_raster2(pc),d1
  205.     move.l    P61_frames(pc),d2
  206.     move.l    P61_positionbase(pc),a0
  207.     move.l    P61_patternbase(pc),a1
  208.     move.l    P61_spos(pc),a2
  209.     rrts
  210.  
  211. P61_IRQsave    dc    0
  212. P61_DMAsave    dc    0
  213. P61_raster    dc.l    0
  214. P61_raster2    dc.l    0
  215. P61_frames    dc.l    0
  216. P61_diri    dc    1
  217.  
  218. *********************************
  219. *        Player 6.1A ®        *
  220. *      All in one-version    *
  221. *        Version 610.1        *
  222. *   © 1992-95 Jarno Paananen    *
  223. *     All rights reserved    *
  224. *********************************
  225.  
  226.  
  227. ******** START OF BINARY FILE **************
  228.  
  229. P61_motuuli
  230.     bra    P61_Init
  231.     ifeq    CIA
  232.     bra    P61_Music
  233.     else
  234.     rts
  235.     rts
  236.     endc
  237.     bra    P61_End
  238.     rts                ;no P61_SetRepeat
  239.     rts
  240.     bra    P61_SetPosition
  241.  
  242. P61_Master    dc    64        ;Master volume (0-64)
  243. P61_Tempo    dc    1        ;Use tempo? 0=no,non-zero=yes
  244. P61_Play    dc    1        ;Stop flag (0=stop)
  245. P61_E8        dc    0        ;Info nybble after command E8
  246. P61_VBR        dc.l    0        ;If you're using non-valid execbase
  247.                     ;put VBR here! (Otherwise 0 assumed)
  248.                     ;You can also get VBR from here, if
  249.                     ;using exec-valid version
  250.  
  251. P61_Pos        dc    0        ;Current song position
  252. P61_Patt    dc    0        ;Current pattern
  253. P61_CRow    dc    0        ;Current pattern row
  254.  
  255. P61_Temp0Offset
  256.     dc.l    P61_temp0-P61_motuuli
  257. P61_Temp1Offset
  258.     dc.l    P61_temp1-P61_motuuli
  259. P61_Temp2Offset
  260.     dc.l    P61_temp2-P61_motuuli
  261. P61_Temp3Offset
  262.     dc.l    P61_temp3-P61_motuuli
  263.  
  264. P61_getnote    macro
  265.     moveq    #$7e,d0
  266.     and.b    (a5),d0
  267.     beq.b    .nonote
  268.     ifne    P61_vib
  269.     clr.b    P61_VibPos(a5)
  270.     endc
  271.     ifne    P61_tre
  272.     clr.b    P61_TrePos(a5)
  273.     endc
  274.  
  275.     ifne    P61_ft
  276.     add    P61_Fine(a5),d0
  277.     endc
  278.     move    d0,P61_Note(a5)
  279.     move    (a2,d0),P61_Period(a5)
  280.  
  281. .nonote
  282.     endm
  283.  
  284.     ifeq    system
  285.     ifne    CIA
  286. P61_intti
  287.     movem.l    d0-a6,-(sp)
  288.     tst.b    $bfdd00
  289.     lea    $dff000,a6
  290.     move    #$2000,$9c(a6)
  291.     move    #$fff,$180(a6)
  292.     bsr    P61_Music
  293.     move    #0,$180(a6)
  294.     movem.l    (sp)+,d0-a6
  295.     nop
  296.     rte
  297.     endc
  298.     endc
  299.  
  300.     ifne    system
  301. P61_lev6server
  302.     movem.l    d2-d7/a2-a6,-(sp)
  303.     lea    $dff000,a6
  304.  
  305.     move    P61_server(pc),d0
  306.     beq.b    P61_musica
  307.     subq    #1,d0
  308.     beq    P61_dmason
  309.     bra    P61_setrepeat
  310.  
  311. P61_musica
  312.     bsr    P61_Music
  313.  
  314. P61_ohi    movem.l    (sp)+,d2-d7/a2-a6
  315.     moveq    #1,d0
  316.     rrts
  317.     endc
  318.  
  319. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  320. ;­ Call P61_Init to initialize the playroutine    ­
  321. ;­ D0 --> Timer detection (for CIA-version)    ­
  322. ;­ A0 --> Address to the module            ­
  323. ;­ A1 --> Address to samples/0            ­
  324. ;­ A2 --> Address to sample buffer        ­
  325. ;­ D0 <-- 0 if succeeded            ­
  326. ;­ A6 <-- $DFF000                ­
  327. ;­         Uses D0-A6            ­
  328. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  329.  
  330. P61_Init
  331.     cmp.l    #"P61A",(a0)+
  332.     beq.b    .modok
  333.     subq.l    #4,a0
  334.  
  335. .modok    basereg    P61_cn,a3
  336.  
  337.     ifne    CIA
  338.     move    d0,-(sp)
  339.     endc
  340.  
  341.     moveq    #0,d0
  342.     cmp.l    d0,a1
  343.     bne.b    .redirect
  344.  
  345.     move    (a0),d0
  346.     lea    (a0,d0.l),a1
  347. .redirect
  348.     move.l    a2,a6
  349.     lea    8(a0),a2
  350.     moveq    #$40,d0
  351.     and.b    3(a0),d0
  352.     bne.b    .buffer
  353.     move.l    a1,a6
  354.     subq.l    #4,a2
  355. .buffer
  356.  
  357.     lea    P61_cn(pc),a3
  358.     moveq    #$1f,d1
  359.     and.b    3(a0),d1
  360.     move.l    a0,-(sp)
  361.     lea    P61_Samples(pc),a4
  362.     subq    #1,d1
  363.     moveq    #0,d4
  364. P61_lopos
  365.     move.l    a6,(a4)+
  366.     move    (a2)+,d4
  367.     bpl.b    P61_kook
  368.     neg    d4
  369.     lea    P61_Samples-16(pc),a5
  370.     ifeq    opt020
  371.     asl    #4,d4
  372.     move.l    (a5,d4),d6
  373.     else
  374.     add    d4,d4
  375.     move.l    (a5,d4*8),d6
  376.     endc
  377.     move.l    d6,-4(a4)
  378.     move    4(a5,d4),d4
  379.     sub.l    d4,a6
  380.     sub.l    d4,a6
  381.     bbra.b    P61_jatk
  382.  
  383. P61_kook
  384.     move.l    a6,d6
  385.     tst.b    3(a0)
  386.     bpl.b    P61_jatk
  387.  
  388.     tst.b    (a2)
  389.     bmi.b    P61_jatk
  390.  
  391.     move    d4,d0
  392.     subq    #2,d0
  393.     bmi.b    P61_jatk
  394.  
  395.     move.l    a1,a5
  396.     move.b    (a5)+,d2
  397.     sub.b    (a5),d2
  398.     move.b    d2,(a5)+
  399. .loop    sub.b    (a5),d2
  400.     move.b    d2,(a5)+
  401.     sub.b    (a5),d2
  402.     move.b    d2,(a5)+
  403.     dbf    d0,.loop
  404.  
  405. P61_jatk
  406.     move    d4,(a4)+
  407.     moveq    #0,d2
  408.     move.b    (a2)+,d2
  409.     moveq    #0,d3
  410.     move.b    (a2)+,d3
  411.  
  412.     moveq    #0,d0
  413.     move    (a2)+,d0
  414.     bmi.b    .norepeat
  415.  
  416.     move    d4,d5
  417.     sub    d0,d5
  418.     move.l    d6,a5
  419.  
  420.     add.l    d0,a5
  421.     add.l    d0,a5
  422.  
  423.     move.l    a5,(a4)+
  424.     move    d5,(a4)+
  425.     bbra.b    P61_gene
  426. .norepeat
  427.     move.l    d6,(a4)+
  428.     move    #1,(a4)+
  429. P61_gene
  430.     move    d3,(a4)+
  431.     moveq    #$f,d0
  432.     and    d2,d0
  433.     mulu    #74,d0
  434.     move    d0,(a4)+
  435.  
  436.     tst    -6(a2)
  437.     bmi.b    .nobuffer
  438.  
  439.     moveq    #$40,d0
  440.     and.b    3(a0),d0
  441.     beq.b    .nobuffer
  442.  
  443.     move    d4,d7
  444.     tst.b    d2
  445.     bpl.b    .copy
  446.  
  447.     subq    #1,d7
  448.     moveq    #0,d5
  449.     moveq    #0,d4
  450. .lo    move.b    (a1)+,d4
  451.     moveq    #$f,d3
  452.     and    d4,d3
  453.     lsr    #4,d4
  454.  
  455.     sub.b    .table(pc,d4),d5
  456.     move.b    d5,(a6)+
  457.     sub.b    .table(pc,d3),d5
  458.     move.b    d5,(a6)+
  459.     dbf    d7,.lo
  460.     bbra.b    .kop
  461.  
  462. .copy    add    d7,d7
  463.     subq    #1,d7
  464. .cob    move.b    (a1)+,(a6)+
  465.     dbf    d7,.cob
  466.     bbra.b    .kop
  467.  
  468. .table dc.b    0,1,2,4,8,16,32,64,128,-64,-32,-16,-8,-4,-2,-1
  469.  
  470. .nobuffer
  471.     move.l    d4,d6
  472.     add.l    d6,d6
  473.     add.l    d6,a6
  474.     add.l    d6,a1
  475. .kop    dbf    d1,P61_lopos
  476.  
  477.     move.l    (sp)+,a0
  478.     and.b    #$7f,3(a0)
  479.  
  480.     move.l    a2,-(sp)
  481.  
  482.     lea    P61_temp0(pc),a1
  483.     lea    P61_temp1(pc),a2
  484.     lea    P61_temp2(pc),a4
  485.     lea    P61_temp3(pc),a5
  486.     moveq    #Channel_Block_SIZE/2-2,d0
  487.  
  488.     moveq    #0,d1
  489. .cl    move    d1,(a1)+
  490.     move    d1,(a2)+
  491.     move    d1,(a4)+
  492.     move    d1,(a5)+
  493.     dbf    d0,.cl
  494.  
  495.     move.l    (sp)+,a2
  496.     move.l    a2,P61_positionbase(a3)
  497.  
  498.     moveq    #$7f,d1
  499.     and.b    2(a0),d1
  500.  
  501.     ifeq    opt020
  502.     lsl    #3,d1
  503.     lea    (a2,d1.l),a4
  504.     else
  505.     lea    (a2,d1.l*8),a4
  506.     endc
  507.     move.l    a4,P61_possibase(a3)
  508.  
  509.     move.l    a4,a1
  510.     moveq    #-1,d0
  511. .search    cmp.b    (a1)+,d0
  512.     bne.b    .search
  513.     move.l    a1,P61_patternbase(a3)    
  514.     move.l    a1,d0
  515.     sub.l    a4,d0
  516.     move    d0,P61_slen(a3)
  517.  
  518.     ifd    start
  519.     lea    start(a4),a4
  520.     endc
  521.  
  522.     moveq    #0,d0
  523.     move.b    (a4)+,d0
  524.     move.l    a4,P61_spos(a3)
  525.     lsl    #3,d0
  526.     add.l    d0,a2
  527.  
  528.     move.l    a1,a4
  529.     moveq    #0,d0    
  530.     move    (a2)+,d0
  531.     lea    (a4,d0.l),a1
  532.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  533.     move    (a2)+,d0
  534.     lea    (a4,d0.l),a1
  535.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  536.     move    (a2)+,d0
  537.     lea    (a4,d0.l),a1
  538.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  539.     move    (a2)+,d0
  540.     lea    (a4,d0.l),a1
  541.     move.l    a1,P61_ChaPos+P61_temp3(a3)
  542.  
  543.     lea    P61_setrepeat(pc),a0
  544.     move.l    a0,P61_intaddr(a3)
  545.  
  546.     move    #63,P61_rowpos(a3)
  547.     move    #6,P61_speed(a3)
  548.     move    #5,P61_speed2(a3)
  549.     clr    P61_speedis1(a3)
  550.  
  551.     ifne    P61_pl
  552.     clr.l    P61_plcount(a3)
  553.     endc
  554.  
  555.     ifne    P61_pde
  556.     clr    P61_pdelay(a3)
  557.     clr    P61_pdflag(a3)
  558.     endc
  559.     clr    (a3)
  560.  
  561.     moveq    #2,d0
  562.     and.b    $bfe001,d0
  563.     move.b    d0,P61_ofilter(a3)
  564.     bset    #1,$bfe001
  565.  
  566.     ifeq    system
  567.     ifne    exec
  568.     move.l    4.w,a6
  569.     moveq    #0,d0
  570.     btst    d0,297(a6)
  571.     beq.b    .no68010
  572.  
  573.     lea    P61_liko(pc),a5
  574.     jsr    -$1e(a6)
  575.  
  576. .no68010
  577.     move.l    d0,P61_VBR(a3)
  578.     endc
  579.  
  580.     move.l    P61_VBR(a3),a0
  581.     lea    $78(a0),a0
  582.     move.l    a0,P61_vektori(a3)
  583.  
  584.     move.l    (a0),P61_oldlev6(a3)
  585.     lea    P61_dmason(pc),a1
  586.     move.l    a1,(a0)
  587.     endc
  588.  
  589.     moveq    #0,d0
  590.     lea    $dff000,a6
  591.     move    d0,$a8(a6)
  592.     move    d0,$b8(a6)
  593.     move    d0,$c8(a6)
  594.     move    d0,$d8(a6)
  595.     move    #$f,$96(a6)
  596.  
  597.     ifeq    system
  598.     lea    P61_dmason(pc),a1
  599.     move.l    a1,(a0)
  600.     move    #$2000,$9a(a6)
  601.     lea    $bfd000,a0
  602.     lea    P61_Timers(pc),a1
  603.     move.b    #$7f,$d00(a0)
  604.     move.b    #$10,$e00(a0)
  605.     move.b    #$10,$f00(a0)
  606.     move.b    $400(a0),(a1)+
  607.     move.b    $500(a0),(a1)+
  608.     move.b    $600(a0),(a1)+
  609.     move.b    $700(a0),(a1)
  610.     endc
  611.  
  612.     ifeq    system!CIA
  613.     move.b    #$82,$d00(a0)
  614.     endc
  615.  
  616.     ifne    CIA
  617.     move    (sp)+,d0
  618.     subq    #1,d0
  619.     beq.b    P61_ForcePAL
  620.     subq    #1,d0
  621.     beq.b    P61_NTSC
  622.     ifne    exec
  623.     move.l    4.w,a1
  624.     cmp.b    #60,$213(a1)    ;PowerSupplyFrequency
  625.     beq.b    P61_NTSC
  626.     endc
  627. P61_ForcePAL
  628.     move.l    #1773447,d0    ;PAL
  629.     bbra.b    P61_setcia
  630. P61_NTSC
  631.     move.l    #1789773,d0    ;NTSC
  632. P61_setcia
  633.     move.l    d0,P61_timer(a3)
  634.     divu    #125,d0
  635.     move    d0,P61_thi2(a3)
  636.     sub    #$1f0*2,d0
  637.     move    d0,P61_thi(a3)
  638.  
  639.     ifeq    system
  640.     move    P61_thi2(a3),d0
  641.     move.b    d0,$400(a0)
  642.     lsr    #8,d0
  643.     move.b    d0,$500(a0)
  644.     lea    P61_intti(pc),a1
  645.     move.l    a1,P61_tintti(a3)
  646.     move.l    P61_vektori(pc),a2
  647.     move.l    a1,(a2)
  648.     move.b    #$83,$d00(a0)
  649.     move.b    #$11,$e00(a0)
  650.     endc
  651.     endc
  652.  
  653.     ifeq    system
  654.     move    #$e000,$9a(a6)
  655.     moveq    #0,d0
  656.     rrts
  657.  
  658.     ifne    exec
  659. P61_liko
  660.     dc.l    $4E7A0801        ;MOVEC    VBR,d0
  661.     rte
  662.     endc
  663.     endc
  664.  
  665.     ifne    system
  666.     move.l    a6,-(sp)
  667.  
  668.     ifne    CIA
  669.     clr    P61_server(a3)
  670.     else
  671.     move    #1,P61_server(a3)
  672.     endc
  673.  
  674.     move.l    4.w,a6
  675.     moveq    #-1,d0
  676.     jsr    -$14a(a6)
  677.     move.b    d0,P61_sigbit(a3)
  678.     bmi    P61_err
  679.  
  680.     lea    P61_allocport(pc),a1
  681.     move.l    a1,P61_portti(a3)
  682.     move.b    d0,15(a1)
  683.     move.l    a1,-(sp)
  684.     suba.l    a1,a1
  685.     jsr    -$126(a6)
  686.     move.l    (sp)+,a1
  687.     move.l    d0,16(a1)
  688.     lea    P61_reqlist(pc),a0
  689.     move.l    a0,(a0)
  690.     addq.l    #4,(a0)
  691.     clr.l    4(a0)
  692.     move.l    a0,8(a0)
  693.  
  694.     lea    P61_dat(pc),a1
  695.     move.l    a1,P61_reqdata(a3)
  696.     lea    P61_allocreq(pc),a1
  697.     lea    P61_audiodev(pc),a0
  698.     moveq    #0,d0
  699.     moveq    #0,d1
  700.     jsr    -$1bc(a6)
  701.     tst.b    d0
  702.     bne    P61_err
  703.     st.b    P61_audioopen(a3)
  704.  
  705.     lea    P61_timerint(pc),a1
  706.     move.l    a1,P61_timerdata(a3)
  707.     lea    P61_lev6server(pc),a1
  708.     move.l    a1,P61_timerdata+8(a3)
  709.  
  710.     moveq    #0,d3
  711.     lea    P61_cianame(pc),a1
  712. P61_openciares
  713.     moveq    #0,d0
  714.     move.l    4.w,a6
  715.     jsr    -$1f2(a6)
  716.     move.l    d0,P61_ciares(a3)
  717.     beq.b    P61_err
  718.     move.l    d0,a6
  719.     lea    P61_timerinterrupt(pc),a1
  720.     moveq    #0,d0
  721.     jsr    -6(a6)
  722.     tst.l    d0
  723.     beq.b    P61_gottimer
  724.     addq.l    #4,d3
  725.     lea    P61_timerinterrupt(pc),a1
  726.     moveq    #1,d0
  727.     jsr    -6(a6)
  728.     tst.l    d0
  729.     bne.b    P61_err
  730.  
  731. P61_gottimer
  732.     lea    P61_craddr+8(pc),a6
  733.     move.l    P61_ciaaddr(pc,d3),d0
  734.     move.l    d0,(a6)
  735.     sub    #$100,d0
  736.     move.l    d0,-(a6)
  737.     moveq    #2,d3
  738.     btst    #9,d0
  739.     bne.b    P61_timerB
  740.     subq.b    #1,d3
  741.     add    #$100,d0
  742. P61_timerB
  743.     add    #$900,d0
  744.     move.l    d0,-(a6)
  745.     move.l    d0,a0
  746.     and.b    #%10000000,(a0)
  747.     move.b    d3,P61_timeropen(a3)
  748.     moveq    #0,d0
  749.  
  750.     ifne    CIA
  751.     move.l    P61_craddr+4(pc),a1
  752.     move.b    P61_tlo(pc),(a1)
  753.     move.b    P61_thi(pc),$100(a1)
  754.     endc
  755.     or.b    #$19,(a0)
  756. P61_pois
  757.     move.l    (sp)+,a6
  758.     rrts
  759.  
  760. P61_err    moveq    #-1,d0
  761.     bbra.b    P61_pois
  762.     rrts
  763.  
  764. P61_ciaaddr
  765.     dc.l    $bfd500,$bfd700
  766.     endc
  767.  
  768. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  769. ;­         Call P61_End to stop the music        ­
  770. ;­   A6 --> Customchip baseaddress ($DFF000)    ­
  771. ;­        Uses D0/D1/A0/A1/A3        ­
  772. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  773.  
  774. P61_End    moveq    #0,d0
  775.     move    d0,$a8(a6)
  776.     move    d0,$b8(a6)
  777.     move    d0,$c8(a6)
  778.     move    d0,$d8(a6)
  779.     move    #$f,$96(a6)
  780.  
  781.     and.b    #~2,$bfe001
  782.     move.b    P61_ofilter(pc),d0
  783.     or.b    d0,$bfe001
  784.  
  785.     ifeq    system
  786.     move    #$2000,$9a(a6)
  787.     move.l    P61_vektori(pc),a0
  788.     move.l    P61_oldlev6(pc),(a0)
  789.     lea    $bfd000,a0
  790.     lea    P61_Timers(pc),a1
  791.     move.b    (a1)+,$400(a0)
  792.     move.b    (a1)+,$500(a0)
  793.     move.b    (a1)+,$600(a0)
  794.     move.b    (a1)+,$700(a0)
  795.     move.b    #$10,$e00(a0)
  796.     move.b    #$10,$f00(a0)
  797.  
  798.     else
  799.     move.l    a6,-(sp)
  800.     lea    P61_cn(pc),a3
  801.     moveq    #0,d0
  802.     move.b    P61_timeropen(pc),d0
  803.     beq.b    P61_rem1
  804.     move.l    P61_ciares(pc),a6
  805.     lea    P61_timerinterrupt(pc),a1
  806.     subq.b    #1,d0
  807.     jsr    -12(a6)
  808. P61_rem1
  809.     move.l    4.w,a6
  810.     tst.b    P61_audioopen(a3)
  811.     beq.b    P61_rem2
  812.     lea    P61_allocreq(pc),a1
  813.     jsr    -$1c2(a6)
  814.     clr.b    P61_audioopen(a3)
  815. P61_rem2
  816.     moveq    #0,d0
  817.     move.b    P61_sigbit(pc),d0
  818.     bmi.b    P61_rem3
  819.     jsr    -$150(a6)
  820.     st    P61_sigbit(a3)
  821. P61_rem3
  822.     move.l    (sp)+,a6
  823.     endc
  824.     rrts
  825.  
  826.     ifne    fade
  827. P61_mfade
  828.     move    P61_Master(pc),d0
  829.     move    P61_temp0+P61_Shadow(pc),d1
  830.     mulu    d0,d1
  831.     lsr    #6,d1
  832.     move    d1,$a8(a6)
  833.  
  834.     ifgt    channels-1
  835.     move    P61_temp1+P61_Shadow(pc),d1
  836.     mulu    d0,d1
  837.     lsr    #6,d1
  838.     move    d1,$b8(a6)
  839.     endc
  840.  
  841.     ifgt    channels-2
  842.     move    P61_temp2+P61_Shadow(pc),d1
  843.     mulu    d0,d1
  844.     lsr    #6,d1
  845.     move    d1,$c8(a6)
  846.     endc
  847.  
  848.     ifgt    channels-3
  849.     move    P61_temp3+P61_Shadow(pc),d1
  850.     mulu    d0,d1
  851.     lsr    #6,d1
  852.     move    d1,$d8(a6)
  853.     endc
  854.     rrts
  855.     endc
  856.     
  857.  
  858. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  859. ;­ Call P61_SetPosition to jump to a specific    ­
  860. ;­          position in the song.        ­
  861. ;­ D0.l --> Position                ­
  862. ;­ Starrts from the beginning if out of limits.    ­
  863. ;­              Uses A0/A1/A3/D0-D3        ­
  864. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  865.  
  866. P61_SetPosition
  867.     ifne    jump
  868.     lea    P61_cn(pc),a3
  869.     ifne    P61_pl
  870.     clr    P61_plflag(a3)
  871.     endc
  872.     moveq    #0,d1
  873.     move.b    d0,d1
  874.     move.l    d1,d0
  875.     cmp    P61_slen(a3),d0
  876.     blo.b    .e
  877.     moveq    #0,d0
  878. .e    move    d0,P61_Pos(a3)
  879.     add.l    P61_possibase(pc),d0
  880.     move.l    d0,P61_spos(a3)
  881.  
  882.     moveq    #64,d0
  883.     move    d0,P61_rowpos(a3)
  884.     clr    P61_CRow(a3)
  885.     move.l    P61_spos(pc),a1
  886.     move.l    P61_patternbase(pc),a0
  887.     addq    #1,P61_Pos(a3)
  888.     move.b    (a1)+,d0
  889.     move.l    a1,P61_spos(a3)
  890.     move.l    P61_positionbase(pc),a1
  891.     move    d0,P61_Patt(a3)
  892.     lsl    #3,d0
  893.     add.l    d0,a1
  894.     movem    (a1),d0-d3
  895.     lea    (a0,d0.l),a1
  896.     move    d1,d0
  897.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  898.     lea    (a0,d0.l),a1
  899.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  900.     move    d2,d0
  901.     lea    (a0,d0.l),a1
  902.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  903.     move    d3,d0
  904.     add.l    d0,a0
  905.     move.l    a0,P61_ChaPos+P61_temp3(a3)
  906.     rrts
  907.     endc
  908.  
  909. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  910. ;­ Call P61_Music every frame to play the music    ­
  911. ;­      _NOT_ if CIA-version is used!        ­
  912. ;­ A6 --> Customchip baseaddress ($DFF000)    ­
  913. ;­              Uses A0-A5/D0-D7        ­
  914. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  915.  
  916. P61_Music
  917.     lea    P61_cn(pc),a3
  918.  
  919.     tst    P61_Play(a3)
  920.     bne.b    P61_ohitaaa
  921.     ifne    CIA
  922.     ifne    system
  923.     move.l    P61_craddr+4(pc),a0
  924.     move.b    P61_tlo2(pc),(a0)
  925.     move.b    P61_thi2(pc),$100(a0)
  926.     endc
  927.     endc
  928.     rrts
  929.  
  930. P61_ohitaaa
  931.     ifne    fade
  932.     pea    P61_mfade(pc)
  933.     endc
  934.  
  935.     moveq    #Channel_Block_SIZE,d6
  936.     moveq    #16,d7
  937.  
  938.     move    (a3),d4
  939.     addq    #1,d4
  940.     cmp    P61_speed(pc),d4
  941.     beq    P61_playtime
  942.  
  943.     move    d4,(a3)
  944.  
  945. P61_delay
  946.     ifne    CIA
  947.     ifne    system
  948.     move.l    P61_craddr+4(pc),a0
  949.     move.b    P61_tlo2(pc),(a0)
  950.     move.b    P61_thi2(pc),$100(a0)
  951.     endc
  952.     endc
  953.  
  954.     lea    P61_temp0(pc),a5
  955.     lea    $a0(a6),a4
  956.  
  957.     moveq    #channels-1,d5
  958. P61_lopas
  959.     tst    P61_OnOff(a5)
  960.     beq    P61_contfxdone
  961.     moveq    #$f,d0
  962.     and    (a5),d0
  963.     ifeq    opt020
  964.     add    d0,d0
  965.     move    P61_jtab2(pc,d0),d0
  966.     else
  967.     move    P61_jtab2(pc,d0*2),d0
  968.     endc
  969.     jmp    P61_jtab2(pc,d0)
  970.  
  971. P61_jtab2
  972.     dc    P61_contfxdone-P61_jtab2
  973.  
  974.     ifne    P61_pu
  975.     dc    P61_portup-P61_jtab2
  976.     else
  977.     dc    P61_contfxdone-P61_jtab2
  978.     endc
  979.  
  980.     ifne    P61_pd
  981.     dc    P61_portdwn-P61_jtab2
  982.     else
  983.     dc    P61_contfxdone-P61_jtab2
  984.     endc
  985.  
  986.     ifne    P61_tp
  987.     dc    P61_toneport-P61_jtab2
  988.     else
  989.     dc    P61_contfxdone-P61_jtab2
  990.     endc
  991.  
  992.     ifne    P61_vib
  993.     dc    P61_vib2-P61_jtab2
  994.     else
  995.     dc    P61_contfxdone-P61_jtab2
  996.     endc
  997.  
  998.     ifne    P61_tpvs
  999.     dc    P61_tpochvslide-P61_jtab2
  1000.     else
  1001.     dc    P61_contfxdone-P61_jtab2
  1002.     endc
  1003.  
  1004.     ifne    P61_vbvs
  1005.     dc    P61_vibochvslide-P61_jtab2
  1006.     else
  1007.     dc    P61_contfxdone-P61_jtab2
  1008.     endc
  1009.  
  1010.     ifne    P61_tre
  1011.     dc    P61_tremo-P61_jtab2
  1012.     else
  1013.     dc    P61_contfxdone-P61_jtab2
  1014.     endc
  1015.  
  1016.     ifne    P61_arp
  1017.     dc    P61_arpeggio-P61_jtab2
  1018.     else
  1019.     dc    P61_contfxdone-P61_jtab2
  1020.     endc
  1021.  
  1022.     dc    P61_contfxdone-P61_jtab2
  1023.  
  1024.     ifne    P61_vs
  1025.     dc    P61_volslide-P61_jtab2
  1026.     else
  1027.     dc    P61_contfxdone-P61_jtab2
  1028.     endc
  1029.  
  1030.     dc    P61_contfxdone-P61_jtab2
  1031.     dc    P61_contfxdone-P61_jtab2
  1032.     dc    P61_contfxdone-P61_jtab2
  1033.  
  1034.     ifne    P61_ec
  1035.     dc    P61_contecommands-P61_jtab2
  1036.     else
  1037.     dc    P61_contfxdone-P61_jtab2
  1038.     endc
  1039.     dc    P61_contfxdone-P61_jtab2
  1040.  
  1041.     ifne    P61_ec
  1042. P61_contecommands
  1043.     move.b    P61_Info(a5),d0
  1044.     and    #$f0,d0
  1045.     lsr    #3,d0
  1046.     move    P61_etab2(pc,d0),d0
  1047.     jmp    P61_etab2(pc,d0)
  1048.  
  1049. P61_etab2
  1050.     dc    P61_contfxdone-P61_etab2
  1051.  
  1052.     ifne    P61_fsu
  1053.     dc    P61_fineup2-P61_etab2
  1054.     else
  1055.     dc    P61_contfxdone-P61_etab2
  1056.     endc
  1057.  
  1058.     ifne    P61_fsd
  1059.     dc    P61_finedwn2-P61_etab2
  1060.     else
  1061.     dc    P61_contfxdone-P61_etab2
  1062.     endc
  1063.  
  1064.     dc    P61_contfxdone-P61_etab2
  1065.     dc    P61_contfxdone-P61_etab2
  1066.  
  1067.     dc    P61_contfxdone-P61_etab2
  1068.     dc    P61_contfxdone-P61_etab2
  1069.  
  1070.     dc    P61_contfxdone-P61_etab2
  1071.     dc    P61_contfxdone-P61_etab2
  1072.  
  1073.     ifne    P61_rt
  1074.     dc    P61_retrig-P61_etab2
  1075.     else
  1076.     dc    P61_contfxdone-P61_etab2
  1077.     endc
  1078.  
  1079.     ifne    P61_fvu
  1080.     dc    P61_finevup2-P61_etab2
  1081.     else
  1082.     dc    P61_contfxdone-P61_etab2
  1083.     endc
  1084.  
  1085.     ifne    P61_fvd
  1086.     dc    P61_finevdwn2-P61_etab2
  1087.     else
  1088.     dc    P61_contfxdone-P61_etab2
  1089.     endc
  1090.  
  1091.     ifne    P61_nc
  1092.     dc    P61_notecut-P61_etab2
  1093.     else
  1094.     dc    P61_contfxdone-P61_etab2
  1095.     endc
  1096.  
  1097.     ifne    P61_nd
  1098.     dc    P61_notedelay-P61_etab2
  1099.     else
  1100.     dc    P61_contfxdone-P61_etab2
  1101.     endc
  1102.  
  1103.     dc    P61_contfxdone-P61_etab2
  1104.     dc    P61_contfxdone-P61_etab2
  1105.     endc
  1106.  
  1107.     ifne    P61_fsu
  1108. P61_fineup2
  1109.     tst    (a3)
  1110.     bne    P61_contfxdone
  1111.     moveq    #$f,d0
  1112.     and.b    P61_Info(a5),d0
  1113.     sub    d0,P61_Period(a5)
  1114.     moveq    #113,d0
  1115.     cmp    P61_Period(a5),d0
  1116.     ble.b    .jup
  1117.     move    d0,P61_Period(a5)
  1118. .jup    move    P61_Period(a5),6(a4)
  1119.     bra    P61_contfxdone
  1120.     endc
  1121.  
  1122.     ifne    P61_fsd
  1123. P61_finedwn2
  1124.     tst    (a3)
  1125.     bne    P61_contfxdone
  1126.     moveq    #$f,d0
  1127.     and.b    P61_Info(a5),d0
  1128.     add    d0,P61_Period(a5)
  1129.     cmp    #856,P61_Period(a5)
  1130.     ble.b    .jup
  1131.     move    #856,P61_Period(a5)
  1132. .jup    move    P61_Period(a5),6(a4)
  1133.     bra    P61_contfxdone
  1134.     endc
  1135.  
  1136.     ifne    P61_fvu
  1137. P61_finevup2
  1138.     tst    (a3)
  1139.     bne    P61_contfxdone
  1140.     moveq    #$f,d0
  1141.     and.b    P61_Info(a5),d0
  1142.     add    d0,P61_Volume(a5)
  1143.     moveq    #64,d0
  1144.     cmp    P61_Volume(a5),d0
  1145.     bge.b    .jup
  1146.     move    d0,P61_Volume(a5)
  1147. .jup    move    P61_Volume(a5),8(a4)
  1148.     bra    P61_contfxdone
  1149.     endc
  1150.  
  1151.     ifne    P61_fvd
  1152. P61_finevdwn2
  1153.     tst    (a3)
  1154.     bne    P61_contfxdone
  1155.     moveq    #$f,d0
  1156.     and.b    P61_Info(a5),d0
  1157.     sub    d0,P61_Volume(a5)
  1158.     bpl.b    .jup
  1159.     clr    P61_Volume(a5)
  1160. .jup    move    P61_Volume(a5),8(a4)
  1161.     bra    P61_contfxdone
  1162.     endc
  1163.  
  1164.     ifne    P61_nc
  1165. P61_notecut
  1166.     moveq    #$f,d0
  1167.     and.b    P61_Info(a5),d0
  1168.     cmp    (a3),d0
  1169.     bne    P61_contfxdone
  1170.     ifeq    fade
  1171.     clr    8(a4)
  1172.     else
  1173.     clr    P61_Shadow(a5)
  1174.     endc
  1175.     clr    P61_Volume(a5)
  1176.     bra    P61_contfxdone
  1177.     endc
  1178.  
  1179.     ifne    P61_nd
  1180. P61_notedelay
  1181.     moveq    #$f,d0
  1182.     and.b    P61_Info(a5),d0
  1183.     cmp    (a3),d0
  1184.     bne    P61_contfxdone
  1185.  
  1186.     moveq    #$7e,d0
  1187.     and.b    (a5),d0
  1188.     beq    P61_contfxdone
  1189.     move    P61_DMABit(a5),d0
  1190.     move    d0,$96(a6)
  1191.     or    d0,P61_dma(a3)
  1192.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1193.     move.l    (a1)+,(a4)+            ;Pointer
  1194.     move    (a1),(a4)+            ;Length
  1195.     move    P61_Period(a5),(a4)
  1196.     subq.l    #6,a4
  1197.  
  1198.     ifeq    system
  1199.     lea    P61_dmason(pc),a1
  1200.     move.l    P61_vektori(pc),a0
  1201.     move.l    a1,(a0)
  1202.     move.b    #$f0,$bfd600
  1203.     move.b    #$01,$bfd700
  1204.     move.b    #$19,$bfdf00
  1205.     else
  1206.     move    #1,P61_server(a3)
  1207.     move.l    P61_craddr+4(pc),a1
  1208.     move.b    #$f0,(a1)
  1209.     move.b    #1,$100(a1)
  1210.     endc
  1211.     bra    P61_contfxdone
  1212.     endc
  1213.  
  1214.     ifne    P61_rt
  1215. P61_retrig
  1216.     subq    #1,P61_RetrigCount(a5)
  1217.     bne    P61_contfxdone
  1218.     move    P61_DMABit(a5),d0
  1219.     move    d0,$96(a6)
  1220.     or    d0,P61_dma(a3)
  1221.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1222.     move.l    (a1)+,(a4)            ;Pointer
  1223.     move    (a1),4(a4)            ;Length
  1224.  
  1225.     ifeq    system
  1226.     lea    P61_dmason(pc),a1
  1227.     move.l    P61_vektori(pc),a0
  1228.     move.l    a1,(a0)
  1229.     move.b    #$f0,$bfd600
  1230.     move.b    #$01,$bfd700
  1231.     move.b    #$19,$bfdf00
  1232.     else
  1233.     move    #1,P61_server(a3)
  1234.     move.l    P61_craddr+4(pc),a1
  1235.     move.b    #$f0,(a1)
  1236.     move.b    #1,$100(a1)
  1237.     endc
  1238.  
  1239.     moveq    #$f,d0
  1240.     and.b    P61_Info(a5),d0
  1241.     move    d0,P61_RetrigCount(a5)
  1242.     bra    P61_contfxdone
  1243.     endc
  1244.  
  1245.     ifne    P61_arp
  1246. P61_arplist
  1247.     dc.b 0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1
  1248.  
  1249. P61_arpeggio
  1250.     move    (a3),d0
  1251.     move.b    P61_arplist(pc,d0),d0
  1252.     beq.b    .arp0
  1253.     subq.b    #1,d0
  1254.     beq.b    P61_arp1
  1255.     moveq    #$f,d0
  1256.     and.b    P61_Info(a5),d0
  1257.     bbra.b    P61_arp3
  1258.  
  1259. .arp0    move    P61_Note(a5),d0
  1260.     move    P61_periods(pc,d0),6(a4)
  1261.     bra    P61_contfxdone
  1262. P61_arp1
  1263.     move.b    P61_Info(a5),d0
  1264.     lsr    #4,d0
  1265. P61_arp3
  1266.     add    d0,d0
  1267.     add    P61_Note(a5),d0
  1268.     move    P61_periods(pc,d0),6(a4)
  1269.     bra    P61_contfxdone
  1270.     endc
  1271.     incdir coding:tools/player6.1a/source/
  1272.  
  1273. P61_periods
  1274.  
  1275.     ifne    P61_ft
  1276.     incbin    periods
  1277.     else
  1278.     incbin    periods.nft
  1279.     endc
  1280.  
  1281.     ifne    P61_vs
  1282. P61_volslide
  1283.     move.b    P61_Info(a5),d0
  1284.     sub.b    d0,P61_Volume+1(a5)
  1285.     bpl.b    .test
  1286.     clr    P61_Volume(a5)
  1287.     ifeq    fade
  1288.     clr    8(a4)
  1289.     else
  1290.     clr    P61_Shadow(a5)
  1291.     endc
  1292.     bra    P61_contfxdone
  1293. .test    moveq    #64,d0
  1294.     cmp    P61_Volume(a5),d0
  1295.     bge.b    .ncs
  1296.     move    d0,P61_Volume(a5)
  1297.     ifeq    fade
  1298.     move    d0,8(a4)
  1299.     else
  1300.     move    d0,P61_Shadow(a5)
  1301.     endc
  1302.     bbra.b    P61_contfxdone
  1303. .ncs    ifeq    fade
  1304.     move    P61_Volume(a5),8(a4)
  1305.     else
  1306.     move    P61_Volume(a5),P61_Shadow(a5)
  1307.     endc
  1308.     bbra.b    P61_contfxdone
  1309.     endc
  1310.  
  1311.     ifne    P61_tpvs
  1312. P61_tpochvslide
  1313.     move.b    P61_Info(a5),d0
  1314.     sub.b    d0,P61_Volume+1(a5)
  1315.     bpl.b    .test
  1316.     clr    P61_Volume(a5)
  1317.     ifeq    fade
  1318.     clr    8(a4)
  1319.     else
  1320.     clr    P61_Shadow(a5)
  1321.     endc
  1322.     bbra.b    P61_toneport
  1323. .test    moveq    #64,d0
  1324.     cmp    P61_Volume(a5),d0
  1325.     bge.b    .ncs
  1326.     move    d0,P61_Volume(a5)
  1327. .ncs    ifeq    fade
  1328.     move    P61_Volume(a5),8(a4)
  1329.     else
  1330.     move    P61_Volume(a5),P61_Shadow(a5)
  1331.     endc
  1332.     endc
  1333.  
  1334.     ifne    P61_tp
  1335. P61_toneport
  1336.     move    P61_ToPeriod(a5),d0
  1337.     beq.b    P61_contfxdone
  1338.     move    P61_TPSpeed(a5),d1
  1339.     cmp    P61_Period(a5),d0
  1340.     blt.b    .topoup
  1341.  
  1342.     add    d1,P61_Period(a5)
  1343.     cmp    P61_Period(a5),d0
  1344.     bgt.b    P61_toposetper
  1345.     move    d0,P61_Period(a5)
  1346.     clr    P61_ToPeriod(a5)
  1347.     move    d0,6(a4)
  1348.     bbra.b    P61_contfxdone
  1349.  
  1350. .topoup
  1351.     sub    d1,P61_Period(a5)
  1352.     cmp    P61_Period(a5),d0
  1353.     blt.b    P61_toposetper
  1354.     move    d0,P61_Period(a5)
  1355.     clr    P61_ToPeriod(a5)
  1356. P61_toposetper
  1357.     move    P61_Period(a5),6(a4)
  1358.     else
  1359.     nop
  1360.     endc
  1361.  
  1362. P61_contfxdone
  1363.     ifne    P61_il
  1364.     bsr    P61_funk2
  1365.     endc
  1366.  
  1367.     add.l    d6,a5
  1368.     add.l    d7,a4
  1369.     dbf    d5,P61_lopas
  1370.  
  1371.     cmp    P61_speed2(pc),d4
  1372.     beq.b    P61_preplay
  1373.     rrts
  1374.  
  1375.     ifne    P61_pu
  1376. P61_portup
  1377.     moveq    #0,D0
  1378.     move.b    P61_Info(a5),d0
  1379.     sub    d0,P61_Period(a5)
  1380.     moveq    #113,d0
  1381.     cmp    P61_Period(a5),d0
  1382.     ble.b    .skip
  1383.     move    d0,P61_Period(a5)
  1384.     move    d0,6(a4)
  1385.     bbra.b    P61_contfxdone
  1386. .skip
  1387.     move    P61_Period(a5),6(a4)
  1388.     bbra.b    P61_contfxdone
  1389.     endc
  1390.  
  1391.     ifne    P61_pd
  1392. P61_portdwn
  1393.     moveq    #0,d0
  1394.     move.b    P61_Info(a5),d0
  1395.     add    d0,P61_Period(a5)
  1396.     cmp    #856,P61_Period(a5)
  1397.     ble.b    .skip
  1398.     move    #856,d0
  1399.     move    d0,P61_Period(a5)
  1400.     move    d0,6(a4)
  1401.     bbra.b    P61_contfxdone
  1402. .skip
  1403.     move    P61_Period(a5),6(a4)
  1404.     bbra.b    P61_contfxdone
  1405.     endc
  1406.  
  1407.     ifne    P61_pde
  1408. P61_return
  1409.     rrts
  1410.  
  1411. P61_preplay
  1412.     tst    P61_pdflag(a3)
  1413.     bne.b    P61_return
  1414.     else
  1415. P61_preplay
  1416.     endc
  1417.  
  1418.     lea    P61_temp0(pc),a5
  1419.     lea    P61_Samples-16(pc),a0
  1420.  
  1421.     moveq    #channels-1,d5
  1422. P61_loaps
  1423.     ifne    P61_pl
  1424.     lea    P61_TData(a5),a1
  1425.     move    2(a5),(a1)+
  1426.     move.l    P61_ChaPos(a5),(a1)+
  1427.     move.l    P61_TempPos(a5),(a1)+
  1428.     move    P61_TempLen(a5),(a1)
  1429.     endc
  1430.  
  1431.     move.b    P61_Pack(a5),d0
  1432.     and.b    #$3f,d0
  1433.     beq.b    P61_takeone
  1434.  
  1435.     tst.b    P61_Pack(a5)
  1436.     bmi.b    .keepsame
  1437.  
  1438.     subq.b    #1,P61_Pack(a5)
  1439.     clr    P61_OnOff(a5)            ; Empty row
  1440.     add.l    d6,a5
  1441.     dbf    d5,P61_loaps
  1442.     rrts
  1443.  
  1444. .keepsame
  1445.     subq.b    #1,P61_Pack(a5)
  1446.     bra    P61_dko
  1447.  
  1448. P61_takeone
  1449.     tst.b    P61_TempLen+1(a5)
  1450.     beq    P61_takenorm
  1451.  
  1452.     subq.b    #1,P61_TempLen+1(a5)
  1453.     move.l    P61_TempPos(a5),a2
  1454.  
  1455. P61_jedi
  1456.     move.b    (a2)+,d0
  1457.     moveq    #%01100000,d1
  1458.     and.b    d0,d1
  1459.     cmp.b    #%01100000,d1
  1460.     bne.b    .all
  1461.  
  1462.     moveq    #%01110000,d1
  1463.     and.b    d0,d1
  1464.     cmp.b    #%01110000,d1
  1465.     bne.b    .cmd
  1466.  
  1467.     moveq    #%01111000,d1
  1468.     and.b    d0,d1
  1469.     cmp.b    #%01111000,d1
  1470.     bne.b    .note
  1471.  
  1472. .empty    clr    P61_OnOff(a5)            ; Empty row
  1473.     clr    (a5)+
  1474.     clr.b    (a5)+
  1475.     tst.b    d0
  1476.     bpl.b    .ex
  1477.     move.b    (a2)+,(a5)            ; Compression info
  1478.     bbra.b    .ex
  1479.  
  1480. .all    move.b    d0,(a5)+
  1481.     ifeq    opt020
  1482.     move.b    (a2)+,(a5)+
  1483.     move.b    (a2)+,(a5)+
  1484.     else
  1485.     move    (a2)+,(a5)+
  1486.     endc
  1487.     tst.b    d0
  1488.     bpl.b    .ex
  1489.     move.b    (a2)+,(a5)            ; Compression info
  1490.     bbra.b    .ex
  1491.  
  1492. .cmd    moveq    #$f,d1
  1493.     and    d0,d1
  1494.     move    d1,(a5)+            ; cmd
  1495.     move.b    (a2)+,(a5)+            ; info
  1496.     tst.b    d0
  1497.     bpl.b    .ex
  1498.     move.b    (a2)+,(a5)            ; Compression info
  1499.     bbra.b    .ex
  1500.  
  1501. .note    moveq    #7,d1
  1502.     and    d0,d1
  1503.     lsl    #8,d1
  1504.     move.b    (a2)+,d1
  1505.     lsl    #4,d1
  1506.     move    d1,(a5)+
  1507.     clr.b    (a5)+    
  1508.     tst.b    d0
  1509.     bpl.b    .ex
  1510.     move.b    (a2)+,(a5)            ; Compression info
  1511. .ex    subq.l    #3,a5
  1512.     move.l    a2,P61_TempPos(a5)
  1513.     bra    P61_dko
  1514.  
  1515.  
  1516. P61_takenorm
  1517.     move.l    P61_ChaPos(a5),a2
  1518.  
  1519.     move.b    (a2)+,d0
  1520.     moveq    #%01100000,d1
  1521.     and.b    d0,d1
  1522.     cmp.b    #%01100000,d1
  1523.     bne.b    .all
  1524.  
  1525.     moveq    #%01110000,d1
  1526.     and.b    d0,d1
  1527.     cmp.b    #%01110000,d1
  1528.     bne.b    .cmd
  1529.  
  1530.     moveq    #%01111000,d1
  1531.     and.b    d0,d1
  1532.     cmp.b    #%01111000,d1
  1533.     bne.b    .note
  1534.  
  1535. .empty    clr    P61_OnOff(a5)            ; Empty row
  1536.     clr    (a5)+
  1537.     clr.b    (a5)+
  1538.     tst.b    d0
  1539.     bpl.b    .proccomp
  1540.     move.b    (a2)+,(a5)            ; Compression info
  1541.     bbra.b    .proccomp
  1542.  
  1543.  
  1544. .all    move.b    d0,(a5)+
  1545.     ifeq    opt020
  1546.     move.b    (a2)+,(a5)+
  1547.     move.b    (a2)+,(a5)+
  1548.     else
  1549.     move    (a2)+,(a5)+
  1550.     endc
  1551.     tst.b    d0
  1552.     bpl.b    .proccomp
  1553.     move.b    (a2)+,(a5)            ; Compression info
  1554.     bbra.b    .proccomp
  1555.  
  1556. .cmd    moveq    #$f,d1
  1557.     and    d0,d1
  1558.     move    d1,(a5)+            ; cmd
  1559.     move.b    (a2)+,(a5)+            ; info
  1560.     tst.b    d0
  1561.     bpl.b    .proccomp
  1562.     move.b    (a2)+,(a5)            ; Compression info
  1563.     bbra.b    .proccomp
  1564.  
  1565. .note    moveq    #7,d1
  1566.     and    d0,d1
  1567.     lsl    #8,d1
  1568.     move.b    (a2)+,d1
  1569.     lsl    #4,d1
  1570.     move    d1,(a5)+
  1571.     clr.b    (a5)+    
  1572.     tst.b    d0
  1573.     bpl.b    .proccomp
  1574.     move.b    (a2)+,(a5)            ; Compression info
  1575.  
  1576. .proccomp
  1577.     subq.l    #3,a5
  1578.     move.l    a2,P61_ChaPos(a5)
  1579.  
  1580.     tst.b    d0
  1581.     bpl.b    P61_dko
  1582.  
  1583.     move.b    3(a5),d0
  1584.     move.b    d0,d1
  1585.     and    #%11000000,d1
  1586.     beq.b    P61_dko                ; Empty datas
  1587.     cmp.b    #%10000000,d1
  1588.     beq.b    P61_dko                ; Same datas
  1589.  
  1590.     clr.b    3(a5)
  1591.     and    #$3f,d0
  1592.     move.b    d0,P61_TempLen+1(a5)
  1593.  
  1594.     cmp.b    #%11000000,d1
  1595.     beq.b    .bit16                ; 16-bit
  1596.  
  1597.     moveq    #0,d0                ; 8-bit
  1598.     move.b    (a2)+,d0
  1599.     move.l    a2,P61_ChaPos(a5)
  1600.     sub.l    d0,a2
  1601.     bra    P61_jedi
  1602.  
  1603. .bit16    moveq    #0,d0
  1604.     ifeq    opt020
  1605.     move.b    (a2)+,d0
  1606.     lsl    #8,d0
  1607.     move.b    (a2)+,d0
  1608.     else
  1609.     move    (a2)+,d0
  1610.     endc
  1611.  
  1612.     move.l    a2,P61_ChaPos(a5)
  1613.     sub.l    d0,a2
  1614.     bra    P61_jedi
  1615.  
  1616.  
  1617. P61_dko    st    P61_OnOff(a5)
  1618.     move    (a5),d0
  1619.     and    #$1f0,d0
  1620.     beq.b    .koto
  1621.     lea    (a0,d0),a1
  1622.     move.l    a1,P61_Sample(a5)
  1623.     ifne    P61_ft
  1624.     move.l    P61_SampleVolume(a1),P61_Volume(a5)
  1625.     else
  1626.     move    P61_SampleVolume(a1),P61_Volume(a5)
  1627.     endc
  1628.     ifne    P61_il
  1629.     move.l    P61_RepeatOffset(a1),P61_Wave(a5)
  1630.     endc
  1631.     ifne    P61_sof
  1632.     clr    P61_Offset(a5)
  1633.     endc
  1634.  
  1635. .koto    add.l    d6,a5
  1636.     dbf    d5,P61_loaps
  1637.     rrts
  1638.  
  1639. P61_playtime
  1640.     clr    (a3)
  1641.  
  1642.     ifne    P61_pde
  1643.     tst    P61_pdelay(a3)
  1644.     beq.b    .djdj
  1645.     subq    #1,P61_pdelay(a3)
  1646.     bra    P61_delay
  1647. .djdj
  1648.     endc
  1649.  
  1650.     clr    P61_pdflag(a3)
  1651.  
  1652.     tst    P61_speedis1(a3)
  1653.     beq.b    .mo
  1654.     bsr    P61_preplay
  1655.  
  1656. .mo    lea    P61_temp0(pc),a5
  1657.     lea    $a0(a6),a4
  1658.  
  1659.     ifeq    system
  1660.     lea    P61_dmason(pc),a1
  1661.     move.l    P61_vektori(pc),a0
  1662.     move.l    a1,(a0)
  1663.     move.b    #$f0,$bfd600
  1664.     move.b    #$01,$bfd700
  1665.     move.b    #$19,$bfdf00
  1666.     else
  1667.     move    #1,P61_server(a3)
  1668.     move.l    P61_craddr+4(pc),a1
  1669.     move.b    #$f0,(a1)
  1670.     move.b    #1,$100(a1)
  1671.     endc
  1672.  
  1673.     lea    P61_periods(pc),a2
  1674.  
  1675.     moveq    #0,d4
  1676.     moveq    #channels-1,d5
  1677. P61_los    tst    P61_OnOff(a5)
  1678.     beq    P61_nocha
  1679.  
  1680.     moveq    #$f,d0
  1681.     and    (a5),d0
  1682.     lea    P61_jtab(pc),a1
  1683.     add    d0,d0
  1684.     add.l    d0,a1
  1685.     add    (a1),a1
  1686.     jmp    (a1)
  1687.  
  1688. P61_fxdone
  1689.     moveq    #$7e,d0
  1690.     and.b    (a5),d0
  1691.     beq.b    P61_nocha
  1692.     ifne    P61_vib
  1693.     clr.b    P61_VibPos(a5)
  1694.     endc
  1695.     ifne    P61_tre
  1696.     clr.b    P61_TrePos(a5)
  1697.     endc
  1698.  
  1699.      ifne    P61_ft
  1700.     add    P61_Fine(a5),d0
  1701.     endc
  1702.     move    d0,P61_Note(a5)
  1703.     move    (a2,d0),P61_Period(a5)
  1704.  
  1705. P61_zample
  1706.     ifne    P61_sof
  1707.     tst    P61_Offset(a5)
  1708.     bne    P61_pek
  1709.     endc
  1710.  
  1711.     or    P61_DMABit(a5),d4
  1712.     move    d4,$96(a6)
  1713.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1714.     move.l    (a1)+,(a4)            ;Pointer
  1715.     move    (a1),4(a4)            ;Length
  1716.  
  1717. P61_nocha
  1718.     ifeq    fade
  1719.     move.l    P61_Period(a5),6(a4)
  1720.     else
  1721.     move    P61_Period(a5),6(a4)
  1722.     move    P61_Volume(a5),P61_Shadow(a5)
  1723.     endc
  1724.  
  1725. P61_skip
  1726.     ifne    P61_il
  1727.     bsr    P61_funk2
  1728.     endc
  1729.  
  1730.     add.l    d6,a5
  1731.     add.l    d7,a4
  1732.     dbf    d5,P61_los
  1733.  
  1734.     move.b    d4,P61_dma+1(a3)
  1735.  
  1736.     ifne    P61_pl
  1737.     tst.b    P61_plflag+1(a3)
  1738.     beq.b    P61_ohittaa
  1739.  
  1740.     lea    P61_temp0(pc),a1
  1741.     lea    P61_looppos(pc),a0
  1742.     moveq    #channels-1,d0
  1743. .talt    move.b    1(a0),3(a1)
  1744.     addq.l    #2,a0
  1745.     move.l    (a0)+,P61_ChaPos(a1)
  1746.     move.l    (a0)+,P61_TempPos(a1)
  1747.     move    (a0)+,P61_TempLen(a1)
  1748.     add.l    d6,a1
  1749.     dbf    d0,.talt
  1750.  
  1751.     move    P61_plrowpos(pc),P61_rowpos(a3)
  1752.     clr.b    P61_plflag+1(a3)
  1753.     moveq    #63,d0
  1754.     sub    P61_rowpos(a3),d0
  1755.     move    d0,P61_CRow(a3)
  1756.     rrts
  1757.     endc
  1758.  
  1759. P61_ohittaa
  1760.     subq    #1,P61_rowpos(a3)
  1761.     bmi.b    P61_nextpattern
  1762.     moveq    #63,d0
  1763.     sub    P61_rowpos(a3),d0
  1764.     move    d0,P61_CRow(a3)
  1765.     rrts
  1766.  
  1767. P61_nextpattern
  1768.     ifne    P61_pl
  1769.     clr    P61_plflag(a3)
  1770.     endc
  1771.     move.l    P61_patternbase(pc),a4
  1772.     moveq    #63,d0
  1773.     move    d0,P61_rowpos(a3)
  1774.     clr    P61_CRow(a3)
  1775.     move.l    P61_spos(pc),a1
  1776.     addq    #1,P61_Pos(a3)
  1777.     move.b    (a1)+,d0
  1778.     bpl.b    P61_dk
  1779.     move.l    P61_possibase(pc),a1
  1780.     move.b    (a1)+,d0
  1781.     clr    P61_Pos(a3)
  1782. P61_dk    move.l    a1,P61_spos(a3)
  1783.     move    d0,P61_Patt(a3)
  1784.     lsl    #3,d0
  1785.     move.l    P61_positionbase(pc),a1
  1786.     add.l    d0,a1
  1787.  
  1788.     move    (a1)+,d0
  1789.     lea    (a4,d0.l),a2
  1790.     move.l    a2,P61_ChaPos+P61_temp0(a3)
  1791.     move    (a1)+,d0
  1792.     lea    (a4,d0.l),a2
  1793.     move.l    a2,P61_ChaPos+P61_temp1(a3)
  1794.     move    (a1)+,d0
  1795.     lea    (a4,d0.l),a2
  1796.     move.l    a2,P61_ChaPos+P61_temp2(a3)
  1797.     move    (a1),d0
  1798.     add.l    d0,a4
  1799.     move.l    a4,P61_ChaPos+P61_temp3(a3)
  1800.     rrts
  1801.  
  1802.     ifne    P61_tp
  1803. P61_settoneport
  1804.     move.b    P61_Info(a5),d0
  1805.     beq.b    P61_toponochange
  1806.     move.b    d0,P61_TPSpeed+1(a5)
  1807. P61_toponochange
  1808.     moveq    #$7e,d0
  1809.     and.b    (a5),d0
  1810.     beq    P61_nocha
  1811.     add    P61_Fine(a5),d0
  1812.     move    d0,P61_Note(a5)
  1813.     move    (a2,d0),P61_ToPeriod(a5)
  1814.     bra    P61_nocha
  1815.     endc
  1816.  
  1817.     ifne    P61_sof
  1818. P61_sampleoffse
  1819.     moveq    #$7e,d0
  1820.     and.b    (a5),d0
  1821.     beq    P61_nocha
  1822.     ifne    P61_vib
  1823.     clr.b    P61_VibPos(a5)
  1824.     endc
  1825.     ifne    P61_tre
  1826.     clr.b    P61_TrePos(a5)
  1827.     endc
  1828.  
  1829.     ifne    P61_ft
  1830.     add    P61_Fine(a5),d0
  1831.     endc
  1832.     move    d0,P61_Note(a5)
  1833.     move    (a2,d0),P61_Period(a5)
  1834.  
  1835.     moveq    #0,d1
  1836.     move    #$ff00,d1
  1837.     and    2(a5),d1
  1838.     bne.b    .deq
  1839.     move    P61_LOffset(a5),d1
  1840. .deq    move    d1,P61_LOffset(a5)
  1841.     add    d1,P61_Offset(a5)
  1842.     move    P61_Offset(a5),d2
  1843.  
  1844.     add    d1,P61_Offset(a5)        ; THIS IS A PT-FEATURE!
  1845.     bbra.b    P61_hup
  1846.  
  1847. P61_pek    moveq    #0,d1
  1848.     move    P61_Offset(a5),d1
  1849. P61_hup    or    P61_DMABit(a5),d4
  1850.     move    d4,$96(a6)
  1851.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1852.     move.l    (a1)+,d0
  1853.     add.l    d1,d0
  1854.     move.l    d0,(a4)                ;Pointer
  1855.     lsr    #1,d1
  1856.     move    (a1),d0
  1857.     sub    d1,d0
  1858.     bpl.b    P61_offok
  1859.     move.l    -4(a1),(a4)            ;Pointer is over the end
  1860.     moveq    #1,d0
  1861. P61_offok
  1862.     move    d0,4(a4)            ;Length
  1863.     bra    P61_nocha
  1864.     endc
  1865.  
  1866.     ifne    P61_vl
  1867. P61_volum
  1868.     move.b    P61_Info(a5),P61_Volume+1(a5)
  1869.     bra    P61_fxdone
  1870.     endc
  1871.  
  1872.     ifne    P61_pj
  1873. P61_posjmp
  1874.     moveq    #0,d0
  1875.     move.b    P61_Info(a5),d0
  1876.     cmp    P61_slen(a3),d0
  1877.     blo.b    .e
  1878.     moveq    #0,d0
  1879. .e    move    d0,P61_Pos(a3)
  1880.     add.l    P61_possibase(pc),d0
  1881.     move.l    d0,P61_spos(a3)
  1882.     endc
  1883.  
  1884.     ifne    P61_pb
  1885. P61_pattbreak
  1886.     moveq    #64,d0
  1887.     move    d0,P61_rowpos(a3)
  1888.     clr    P61_CRow(a3)
  1889.     move.l    P61_spos(pc),a1
  1890.     move.l    P61_patternbase(pc),a0
  1891.     addq    #1,P61_Pos(a3)
  1892.     move.b    (a1)+,d0
  1893.     bpl.b    P61_dk2
  1894.     move.l    P61_possibase(pc),a1
  1895.     move.b    (a1)+,d0
  1896.     clr    P61_Pos(a3)
  1897. P61_dk2    move.l    a1,P61_spos(a3)
  1898.     move.l    P61_positionbase(pc),a1
  1899.     move    d0,P61_Patt(a3)
  1900.     lsl    #3,d0
  1901.     add.l    d0,a1
  1902.     movem    (a1),d0-d3
  1903.     lea    (a0,d0.l),a1
  1904.     move    d1,d0
  1905.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  1906.     lea    (a0,d0.l),a1
  1907.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  1908.     move    d2,d0
  1909.     lea    (a0,d0.l),a1
  1910.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  1911.     move    d3,d0
  1912.     add.l    d0,a0
  1913.     move.l    a0,P61_ChaPos+P61_temp3(a3)
  1914.     bra    P61_fxdone
  1915.     endc
  1916.  
  1917.     ifne    P61_vib
  1918. P61_vibrato
  1919.     move.b    P61_Info(a5),d0
  1920.     beq    P61_fxdone
  1921.     move.b    d0,d1
  1922.     move.b    P61_VibCmd(a5),d2
  1923.     and.b    #$f,d0
  1924.     beq.b    P61_vibskip
  1925.     and.b    #$f0,d2
  1926.     or.b    d0,d2
  1927. P61_vibskip
  1928.     and.b    #$f0,d1
  1929.     beq.b    P61_vibskip2
  1930.     and.b    #$f,d2
  1931.     or.b    d1,d2
  1932. P61_vibskip2
  1933.     move.b    d2,P61_VibCmd(a5)
  1934.     bra    P61_fxdone
  1935.     endc
  1936.  
  1937.     ifne    P61_tre
  1938. P61_settremo
  1939.     move.b    P61_Info(a5),d0
  1940.     beq    P61_fxdone
  1941.     move.b    d0,d1
  1942.     move.b    P61_TreCmd(a5),d2
  1943.     moveq    #$f,d3
  1944.     and.b    d3,d0
  1945.     beq.b    P61_treskip
  1946.     and.b    #$f0,d2
  1947.     or.b    d0,d2
  1948. P61_treskip
  1949.     and.b    #$f0,d1
  1950.     beq.b    P61_treskip2
  1951.     and.b    d3,d2
  1952.     or.b    d1,d2
  1953. P61_treskip2
  1954.     move.b    d2,P61_TreCmd(a5)
  1955.     bra    P61_fxdone
  1956.     endc
  1957.  
  1958.     ifne    P61_ec
  1959. P61_ecommands
  1960.     move.b    P61_Info(a5),d0
  1961.     and.b    #$f0,d0
  1962.     lsr    #3,d0
  1963.     move    P61_etab(pc,d0),d0
  1964.     jmp    P61_etab(pc,d0)
  1965.  
  1966. P61_etab
  1967.     ifne    P61_fi
  1968.     dc    P61_filter-P61_etab
  1969.     else
  1970.     dc    P61_fxdone-P61_etab
  1971.     endc
  1972.  
  1973.     ifne    P61_fsu
  1974.     dc    P61_fineup-P61_etab
  1975.     else
  1976.     dc    P61_fxdone-P61_etab
  1977.     endc
  1978.  
  1979.     ifne    P61_fsd
  1980.     dc    P61_finedwn-P61_etab
  1981.     else
  1982.     dc    P61_fxdone-P61_etab
  1983.     endc
  1984.  
  1985.     dc    P61_fxdone-P61_etab
  1986.     dc    P61_fxdone-P61_etab
  1987.  
  1988.     ifne    P61_sft
  1989.     dc    P61_setfinetune-P61_etab
  1990.     else
  1991.     dc    P61_fxdone-P61_etab
  1992.     endc
  1993.  
  1994.     ifne    P61_pl
  1995.     dc    P61_patternloop-P61_etab
  1996.     else
  1997.     dc    P61_fxdone-P61_etab
  1998.     endc
  1999.  
  2000.     dc    P61_fxdone-P61_etab
  2001.  
  2002.     ifne    P61_timing
  2003.     dc    P61_sete8-P61_etab
  2004.     else
  2005.     dc    P61_fxdone-P61_etab
  2006.     endc
  2007.  
  2008.     ifne    P61_rt
  2009.     dc    P61_setretrig-P61_etab
  2010.     else
  2011.     dc    P61_fxdone-P61_etab
  2012.     endc
  2013.  
  2014.     ifne    P61_fvu
  2015.     dc    P61_finevup-P61_etab
  2016.     else
  2017.     dc    P61_fxdone-P61_etab
  2018.     endc
  2019.  
  2020.     ifne    P61_fvd
  2021.     dc    P61_finevdwn-P61_etab
  2022.     else
  2023.     dc    P61_fxdone-P61_etab
  2024.     endc
  2025.  
  2026.     dc    P61_fxdone-P61_etab
  2027.  
  2028.     ifne    P61_nd
  2029.     dc    P61_ndelay-P61_etab
  2030.     else
  2031.     dc    P61_fxdone-P61_etab
  2032.     endc
  2033.  
  2034.     ifne    P61_pde
  2035.     dc    P61_pattdelay-P61_etab
  2036.     else
  2037.     dc    P61_fxdone-P61_etab
  2038.     endc
  2039.  
  2040.     ifne    P61_il
  2041.     dc    P61_funk-P61_etab
  2042.     else
  2043.     dc    P61_fxdone-P61_etab
  2044.     endc
  2045.     endc
  2046.  
  2047.     ifne    P61_fi
  2048. P61_filter
  2049.     move.b    P61_Info(a5),d0
  2050.     and.b    #$fd,$bfe001
  2051.     or.b    d0,$bfe001
  2052.     bra    P61_fxdone
  2053.     endc
  2054.  
  2055.     ifne    P61_fsu
  2056. P61_fineup
  2057.     P61_getnote
  2058.  
  2059.     moveq    #$f,d0
  2060.     and.b    P61_Info(a5),d0
  2061.     sub    d0,P61_Period(a5)
  2062.     moveq    #113,d0
  2063.     cmp    P61_Period(a5),d0
  2064.     ble.b    .jup
  2065.     move    d0,P61_Period(a5)
  2066. .jup    moveq    #$7e,d0
  2067.     and.b    (a5),d0
  2068.     bne    P61_zample
  2069.     bra    P61_nocha
  2070.     endc
  2071.  
  2072.     ifne    P61_fsd
  2073. P61_finedwn
  2074.     P61_getnote
  2075.  
  2076.     moveq    #$f,d0
  2077.     and.b    P61_Info(a5),d0
  2078.     add    d0,P61_Period(a5)
  2079.     cmp    #856,P61_Period(a5)
  2080.     ble.b    .jup
  2081.     move    #856,P61_Period(a5)
  2082. .jup    moveq    #$7e,d0
  2083.     and.b    (a5),d0
  2084.     bne    P61_zample
  2085.     bra    P61_nocha
  2086.     endc
  2087.  
  2088.     ifne    P61_sft
  2089. P61_setfinetune
  2090.     moveq    #$f,d0
  2091.     and.b    P61_Info(a5),d0
  2092.     ifeq    opt020
  2093.     add    d0,d0
  2094.     move    P61_mulutab(pc,d0),P61_Fine(a5)
  2095.     else
  2096.     move    P61_mulutab(pc,d0*2),P61_Fine(a5)
  2097.     endc
  2098.     bra    P61_fxdone
  2099.  
  2100. P61_mulutab
  2101.     dc    0,74,148,222,296,370,444,518,592,666,740,814,888,962,1036,1110
  2102.     endc
  2103.  
  2104.     ifne    P61_pl
  2105. P61_patternloop
  2106.     moveq    #$f,d0
  2107.     and.b    P61_Info(a5),d0
  2108.     beq.b    P61_setloop
  2109.  
  2110.     tst.b    P61_plflag(a3)
  2111.     bne.b    P61_noset
  2112.  
  2113.     move    d0,P61_plcount(a3)
  2114.     st.b    P61_plflag(a3)
  2115. P61_noset
  2116.     tst    P61_plcount(a3)
  2117.     bne.b    P61_looppaa
  2118.     clr.b    P61_plflag(a3)
  2119.     bra    P61_fxdone
  2120.     
  2121. P61_looppaa
  2122.     st.b    P61_plflag+1(a3)
  2123.     subq    #1,P61_plcount(a3)
  2124.     bra    P61_fxdone
  2125.  
  2126. P61_setloop
  2127.     tst.b    P61_plflag(a3)
  2128.     bne    P61_fxdone
  2129.     move    P61_rowpos(pc),P61_plrowpos(a3)
  2130.     lea    P61_temp0+P61_TData(pc),a1
  2131.     lea    P61_looppos(pc),a0
  2132.     moveq    #channels-1,d0
  2133. .talt    move.l    (a1)+,(a0)+
  2134.     move.l    (a1)+,(a0)+
  2135.     move.l    (a1),(a0)+
  2136.     subq.l    #8,a1
  2137.     add.l    d6,a1
  2138.     dbf    d0,.talt
  2139.     bra    P61_fxdone
  2140.     endc
  2141.  
  2142.     ifne    P61_fvu
  2143. P61_finevup
  2144.     moveq    #$f,d0
  2145.     and.b    P61_Info(a5),d0
  2146.     add    d0,P61_Volume(a5)
  2147.     moveq    #64,d0
  2148.     cmp    P61_Volume(a5),d0
  2149.     bge    P61_fxdone
  2150.     move    d0,P61_Volume(a5)
  2151.     bra    P61_fxdone
  2152.     endc
  2153.  
  2154.     ifne    P61_fvd
  2155. P61_finevdwn
  2156.     moveq    #$f,d0
  2157.     and.b    P61_Info(a5),d0
  2158.     sub    d0,P61_Volume(a5)
  2159.     bpl    P61_fxdone
  2160.     clr    P61_Volume(a5)
  2161.     bra    P61_fxdone
  2162.     endc
  2163.  
  2164.     ifne    P61_timing
  2165. P61_sete8
  2166.     moveq    #$f,d0
  2167.     and.b    P61_Info(a5),d0
  2168.     move    d0,P61_E8(a3)
  2169.     bra    P61_fxdone
  2170.     endc
  2171.  
  2172.     ifne    P61_rt
  2173. P61_setretrig
  2174.     moveq    #$f,d0
  2175.     and.b    P61_Info(a5),d0
  2176.     move    d0,P61_RetrigCount(a5)
  2177.     bra    P61_fxdone
  2178.     endc
  2179.  
  2180.     ifne    P61_nd
  2181. P61_ndelay
  2182.     moveq    #$7e,d0
  2183.     and.b    (a5),d0
  2184.     beq    P61_skip
  2185.     ifne    P61_vib
  2186.     clr.b    P61_VibPos(a5)
  2187.     endc
  2188.     ifne    P61_tre
  2189.     clr.b    P61_TrePos(a5)
  2190.     endc
  2191.     ifne    P61_ft
  2192.     add    P61_Fine(a5),d0
  2193.     endc
  2194.     move    d0,P61_Note(a5)
  2195.     move    (a2,d0),P61_Period(a5)
  2196.     ifeq    fade
  2197.     move    P61_Volume(a5),8(a4)
  2198.     else
  2199.     move    P61_Volume(a5),P61_Shadow(a5)
  2200.     endc
  2201.     bra    P61_skip
  2202.     endc
  2203.  
  2204.     ifne    P61_pde
  2205. P61_pattdelay
  2206.     moveq    #$f,d0
  2207.     and.b    P61_Info(a5),d0
  2208.     move    d0,P61_pdelay(a3)
  2209.     st    P61_pdflag(a3)
  2210.     bra    P61_fxdone
  2211.     endc
  2212.  
  2213.     ifne    P61_sd
  2214. P61_cspeed
  2215.     moveq    #0,d0
  2216.     move.b    P61_Info(a5),d0
  2217.  
  2218.     ifne    CIA
  2219.     tst    P61_Tempo(a3)
  2220.     beq.b    P61_VBlank
  2221.     cmp.b    #32,d0
  2222.     bhs.b    P61_STempo
  2223.     endc
  2224.  
  2225. P61_VBlank
  2226.     cmp.b    #1,d0
  2227.     beq.b    P61_jkd
  2228.  
  2229.     move.b    d0,P61_speed+1(a3)
  2230.     subq.b    #1,d0
  2231.     move.b    d0,P61_speed2+1(a3)
  2232.     clr    P61_speedis1(a3)
  2233.     bra    P61_fxdone
  2234.  
  2235. P61_jkd    move.b    d0,P61_speed+1(a3)
  2236.     move.b    d0,P61_speed2+1(a3)
  2237.     st    P61_speedis1(a3)
  2238.     bra    P61_fxdone
  2239.  
  2240.  
  2241.     ifne    CIA
  2242. P61_STempo
  2243.     move.l    P61_timer(pc),d1
  2244.     divu    d0,d1
  2245.     move    d1,P61_thi2(a3)
  2246.     sub    #$1f0*2,d1
  2247.     move    d1,P61_thi(a3)
  2248.  
  2249.     ifeq    system
  2250.     move    P61_thi2(a3),d1
  2251.     move.b    d1,$bfd400
  2252.     lsr    #8,d1
  2253.     move.b    d1,$bfd500
  2254.     endc
  2255.  
  2256.     bra    P61_fxdone
  2257.     endc
  2258.     endc
  2259.  
  2260.  
  2261.  
  2262.     ifne    P61_vbvs
  2263. P61_vibochvslide
  2264.     move.b    P61_Info(a5),d0
  2265.     sub.b    d0,P61_Volume+1(a5)
  2266.     bpl.b    P61_test62
  2267.     clr    P61_Volume(a5)
  2268.     ifeq    fade
  2269.     clr    8(a4)
  2270.     else
  2271.     clr    P61_Shadow(a5)
  2272.     endc
  2273.     bbra.b    P61_vib2
  2274. P61_test62
  2275.     moveq    #64,d0
  2276.     cmp    P61_Volume(a5),d0
  2277.     bge.b    .ncs2
  2278.     move    d0,P61_Volume(a5)
  2279. .ncs2    ifeq    fade
  2280.     move    P61_Volume(a5),8(a4)
  2281.     else
  2282.     move    P61_Volume(a5),P61_Shadow(a5)
  2283.     endc
  2284.     endc
  2285.  
  2286.     ifne    P61_vib
  2287. P61_vib2
  2288.     move    #$f00,d0
  2289.     move    P61_VibCmd(a5),d1
  2290.     and    d1,d0
  2291.     lsr    #3,d0
  2292.  
  2293.     lsr    #2,d1
  2294.     and    #$1f,d1
  2295.     add    d1,d0
  2296.  
  2297.     move    P61_Period(a5),d1
  2298.     moveq    #0,d2
  2299.     move.b    P61_vibtab(pc,d0),d2
  2300.  
  2301.     tst.b    P61_VibPos(a5)
  2302.     bmi.b    .vibneg
  2303.     add    d2,d1
  2304.     bbra.b    P61_vib4
  2305.  
  2306. .vibneg    sub    d2,d1
  2307.  
  2308. P61_vib4
  2309.     move    d1,6(a4)
  2310.     move.b    P61_VibCmd(a5),d0
  2311.     lsr.b    #2,d0
  2312.     and    #$3c,d0
  2313.     add.b    d0,P61_VibPos(a5)
  2314.     bra    P61_contfxdone
  2315.     endc
  2316.  
  2317.     ifne    P61_tre
  2318. P61_tremo
  2319.     move    #$f00,d0
  2320.     move    P61_TreCmd(a5),d1
  2321.     and    d1,d0
  2322.     lsr    #3,d0
  2323.     
  2324.     lsr    #2,d1
  2325.     and    #$1f,d1
  2326.     add    d1,d0
  2327.  
  2328.     move    P61_Volume(a5),d1
  2329.     moveq    #0,d2
  2330.     move.b    P61_vibtab(pc,d0),d2
  2331.  
  2332.     tst.b    P61_TrePos(a5)
  2333.     bmi.b    .treneg
  2334.     add    d2,d1
  2335.     cmp    #64,d1
  2336.     ble.b    P61_tre4
  2337.     moveq    #64,d1
  2338.     bbra.b    P61_tre4
  2339.  
  2340. .treneg    sub    d2,d1
  2341.     bpl.b    P61_tre4
  2342.     moveq    #0,d1
  2343. P61_tre4
  2344.     ifeq    fade
  2345.     move    d1,8(a4)
  2346.     else
  2347.     move    d1,P61_Shadow(a5)
  2348.     endc
  2349.  
  2350.     move.b    P61_TreCmd(a5),d0
  2351.     lsr.b    #2,d0
  2352.     and    #$3c,d0
  2353.     add.b    d0,P61_TrePos(a5)
  2354.     bra    P61_contfxdone
  2355.     endc
  2356.  
  2357.     ifne    P61_vib!P61_tre
  2358. P61_vibtab    incbin    vibtab
  2359.     endc
  2360.  
  2361.     ifne    P61_il
  2362. P61_funk
  2363.     moveq    #$f,d0
  2364.     and.b    P61_Info(a5),d0
  2365.     move.b    d0,P61_Funkspd(a5)
  2366.     bra    P61_fxdone
  2367.  
  2368. P61_funk2
  2369.     moveq    #0,d0
  2370.     move.b    P61_Funkspd(a5),d0
  2371.     beq.b    P61_funkend
  2372.     move.b    P61_FunkTable(pc,d0),d0
  2373.     add.b    d0,P61_Funkoff(a5)
  2374.     bpl.b    P61_funkend
  2375.     clr.b    P61_Funkoff(a5)
  2376.  
  2377.     move.l    P61_Sample(a5),a1
  2378.     move.l    P61_RepeatOffset(a1),d1
  2379.     move    P61_RepeatLength(a1),d0
  2380.     add.l    d0,d0
  2381.     add.l    d1,d0
  2382.     move.l    P61_Wave(a5),a0
  2383.     addq.l    #1,a0
  2384.     cmp.l    d0,a0
  2385.     blo.b    P61_funkok
  2386.     move.l    d1,a0
  2387. P61_funkok
  2388.     move.l    a0,P61_Wave(a5)
  2389.     not.b    (a0)
  2390. P61_funkend
  2391.     rrts
  2392.  
  2393. P61_FunkTable dc.b 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128
  2394.     endc
  2395.  
  2396. P61_jtab
  2397.     dr    P61_fxdone
  2398.     dr    P61_fxdone
  2399.     dr    P61_fxdone
  2400.  
  2401.     ifne    P61_tp
  2402.     dr    P61_settoneport
  2403.     else
  2404.     dr    P61_fxdone
  2405.     endc
  2406.  
  2407.     ifne    P61_vib
  2408.     dr    P61_vibrato
  2409.     else
  2410.     dr    P61_fxdone
  2411.     endc
  2412.  
  2413.     ifne    P61_tpvs
  2414.     dr    P61_toponochange
  2415.     else
  2416.     dr    P61_fxdone
  2417.     endc
  2418.  
  2419.     dr    P61_fxdone
  2420.  
  2421.     ifne    P61_tre
  2422.     dr    P61_settremo
  2423.     else
  2424.     dr    P61_fxdone
  2425.     endc
  2426.  
  2427.     dr    P61_fxdone
  2428.  
  2429.     ifne    P61_sof
  2430.     dr    P61_sampleoffse
  2431.     else
  2432.     dr    P61_fxdone
  2433.     endc
  2434.     dr    P61_fxdone
  2435.  
  2436.     ifne    P61_pj
  2437.     dr    P61_posjmp
  2438.     else
  2439.     dr    P61_fxdone
  2440.     endc
  2441.  
  2442.     ifne    P61_vl
  2443.     dr    P61_volum
  2444.     else
  2445.     dr    P61_fxdone
  2446.     endc
  2447.  
  2448.     ifne    P61_pb
  2449.     dr    P61_pattbreak
  2450.     else
  2451.     dr    P61_fxdone
  2452.     endc
  2453.  
  2454.     ifne    P61_ec
  2455.     dr    P61_ecommands
  2456.     else
  2457.     dr    P61_fxdone
  2458.     endc
  2459.     
  2460.     ifne    P61_sd
  2461.     dr    P61_cspeed
  2462.     else
  2463.     dr    P61_fxdone
  2464.     endc
  2465.  
  2466.  
  2467. P61_dmason
  2468.     ifeq    system
  2469.     tst.b    $bfdd00
  2470.     move    #$2000,$dff09c
  2471.     move.b    #$19,$bfdf00
  2472.     move.l    a0,-(sp)
  2473.     move.l    P61_vektori(pc),a0
  2474.     move.l    P61_intaddr(pc),(a0)
  2475.     move.l    (sp)+,a0
  2476.     move    P61_dma(pc),$dff096
  2477.     nop
  2478.     rte
  2479.  
  2480.     else
  2481.  
  2482.     move    P61_dma(pc),$96(a6)
  2483.     lea    P61_server(pc),a3
  2484.     addq    #1,(a3)
  2485.     move.l    P61_craddr(pc),a0
  2486.     move.b    #$19,(a0)
  2487.     bra    P61_ohi
  2488.     endc
  2489.  
  2490.  
  2491. P61_setrepeat
  2492.     ifeq    system
  2493.     tst.b    $bfdd00
  2494.     movem.l    a0/a1,-(sp)
  2495.     lea    $dff0a0,a1
  2496.     move    #$2000,-4(a1)
  2497.     else
  2498.     lea    $a0(a6),a1
  2499.     endc
  2500.  
  2501.     move.l    P61_Sample+P61_temp0(pc),a0
  2502.     addq.l    #6,a0
  2503.     move.l    (a0)+,(a1)+
  2504.     move    (a0),(a1)
  2505.  
  2506.     ifgt    channels-1
  2507.     move.l    P61_Sample+P61_temp1(pc),a0
  2508.     addq.l    #6,a0
  2509.     move.l    (a0)+,12(a1)
  2510.     move    (a0),16(a1)
  2511.     endc
  2512.     
  2513.     ifgt    channels-2
  2514.     move.l    P61_Sample+P61_temp2(pc),a0
  2515.     addq.l    #6,a0
  2516.     move.l    (a0)+,28(a1)
  2517.     move    (a0),32(a1)
  2518.     endc
  2519.  
  2520.     ifgt    channels-3
  2521.     move.l    P61_Sample+P61_temp3(pc),a0
  2522.     addq.l    #6,a0
  2523.     move.l    (a0)+,44(a1)
  2524.     move    (a0),48(a1)
  2525.     endc
  2526.  
  2527.     ifne    system
  2528.     ifne    CIA
  2529.     lea    P61_server(pc),a3
  2530.     clr    (a3)
  2531.     move.l    P61_craddr+4(pc),a0
  2532.     move.b    P61_tlo(pc),(a0)
  2533.     move.b    P61_thi(pc),$100(a0)
  2534.     endc
  2535.     bra    P61_ohi
  2536.     endc
  2537.  
  2538.     ifeq    system
  2539.     ifne    CIA
  2540.     move.l    P61_vektori(pc),a0
  2541.     move.l    P61_tintti(pc),(a0)
  2542.     endc
  2543.     movem.l    (sp)+,a0/a1
  2544.     nop
  2545.     rte
  2546.     endc
  2547.  
  2548. P61_temp0    dcb.b    Channel_Block_SIZE-2
  2549.         dc    1
  2550.  
  2551. P61_temp1    dcb.b    Channel_Block_SIZE-2
  2552.         dc    2
  2553.  
  2554. P61_temp2    dcb.b    Channel_Block_SIZE-2
  2555.         dc    4
  2556.  
  2557. P61_temp3    dcb.b    Channel_Block_SIZE-2
  2558.         dc    8
  2559.  
  2560. P61_cn        dc    0
  2561. P61_dma        dc    $8200
  2562. P61_rowpos    dc    0
  2563. P61_slen    dc    0
  2564. P61_speed    dc    0
  2565. P61_speed2    dc    0
  2566. P61_speedis1    dc    0
  2567. P61_spos    dc.l    0
  2568.  
  2569.     ifeq    system
  2570. P61_vektori    dc.l    0
  2571. P61_oldlev6    dc.l    0
  2572.     endc
  2573.  
  2574. P61_ofilter    dc    0
  2575. P61_Timers    dc.l    0
  2576.  
  2577.     ifne    CIA
  2578. P61_tintti    dc.l    0
  2579. P61_thi        dc.b    0
  2580. P61_tlo        dc.b    0
  2581. P61_thi2    dc.b    0
  2582. P61_tlo2    dc.b    0
  2583. P61_timer    dc.l    0
  2584.     endc
  2585.  
  2586.     ifne    P61_pl
  2587. P61_plcount    dc    0
  2588. P61_plflag    dc    0
  2589. P61_plreset    dc    0
  2590. P61_plrowpos    dc    0
  2591. P61_looppos    dcb.b    12*channels
  2592.     endc
  2593.  
  2594.     ifne    P61_pde
  2595. P61_pdelay    dc    0
  2596. P61_pdflag    dc    0
  2597.     endc
  2598.  
  2599. P61_Samples    dcb.b    16*31
  2600. P61_positionbase dc.l    0
  2601. P61_possibase    dc.l    0
  2602. P61_patternbase    dc.l    0
  2603. P61_intaddr    dc.l    0
  2604.  
  2605.     ifne    system
  2606. P61_server    dc    0
  2607. P61_miscbase    dc.l    0
  2608. P61_audioopen    dc.b    0
  2609. P61_sigbit    dc.b    -1
  2610. P61_ciares    dc.l    0
  2611. P61_craddr    dc.l    0,0,0
  2612. P61_dat        dc    $f00
  2613. P61_timerinterrupt dc    0,0,0,0,127
  2614. P61_timerdata    dc.l    0,0,0
  2615.  
  2616. P61_allocport    dc.l    0,0
  2617.         dc.b    4,0
  2618.         dc.l    0
  2619.         dc.b    0,0
  2620.         dc.l    0
  2621. P61_reqlist    dc.l    0,0,0
  2622.         dc.b    5,0
  2623. P61_allocreq    dc.l    0,0
  2624.         dc    127
  2625.         dc.l    0
  2626. P61_portti    dc.l    0
  2627.         dc    68
  2628.         dc.l    0,0,0
  2629.         dc    0
  2630. P61_reqdata    dc.l    0
  2631.         dc.l    1,0,0,0,0,0,0
  2632.         dc    0
  2633. P61_audiodev    dc.b    'audio.device',0
  2634.  
  2635. P61_cianame    dc.b    'ciab.resource',0
  2636. P61_timeropen    dc.b    0
  2637. P61_timerint    dc.b    'P61_TimerInterrupt',0,0
  2638.     endc
  2639. P61_etu
  2640.  
  2641.     endb    a3
  2642.  
  2643.  
  2644. ******** END OF BINARY FILE **************
  2645.  
  2646.     section    chip,data_c
  2647. P61_data    incbin    "atro:music/p61.149006"
  2648.  
  2649.     section    smp,bss_c
  2650. samples    ds.b    $10000        ;uncomment if you have packed samples
  2651.                 ;and insert sample buffer length
  2652.